package com.ft.oa.enums;

/**
 * 质保状态 质保状态 0-质保中 1-质保结束 2-续保
 * @author liyansheng
 * @ClassName WarrantyStatus
 * @date 2022-1-14 11:44:31
 */
public enum WarrantyStatus {

    WARRANTING(0,"质保中"),
    WARRANTED(1,"质保结束"),
    WARRANTY(2,"续保");

    //名称
    private String name;
    //编码
    private int code;
    //构造函数
    WarrantyStatus(int code, String name){
        this.code = code;
        this.name = name;
    }

    /**
     * 获取名称
     * @param code
     * @return
     */
    public static String getByCode(int code) {
        for (WarrantyStatus value : WarrantyStatus.values()) {
            if (value.code == code) {
                return value.name;
            }
        }
        return "";
    }
}
